package com.skyworth.web.order.form;

import com.skyworth.web.order.domain.OrderModel;
import com.skyworth.web.order.domain.ParentOrderModel;

import java.util.List;
import java.util.Map;

/**
 * Created by skyworth on 2016/6/23.
 */
public class OrderForm {
    private long id;
    private String userId;
    private long storeId;

    private String userName;
    private float price;
    private float originalPrice;
    private String content; //附加说明 忌口信息等
    private int count;
    private List<Map<String,Object>> foods;

    private long tableId;
    private int people;
    private int state;

    public long getTableId() {
        return tableId;
    }

    public void setTableId(long tableId) {
        this.tableId = tableId;
    }

    public int getPeople() {
        return people;
    }

    public void setPeople(int people) {
        this.people = people;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getStoreId() {
        return storeId;
    }

    public void setStoreId(long storeId) {
        this.storeId = storeId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public float getPrice() {
        return price;
    }

    public void setPrice(float price) {
        this.price = price;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public static OrderModel toOrderModel(OrderForm form){
        OrderModel orderModel = new OrderModel();
        orderModel.id = form.id;
        orderModel.userId = form.userId;
        orderModel.userName = form.userName;
        orderModel.price = form.price;
        orderModel.storeId = form.storeId;
        orderModel.content = form.content == null ? "" : form.content;
        orderModel.tableId=form.tableId;
        orderModel.people=form.people;
        orderModel.originalPrice = form.originalPrice;
        orderModel.state = form.state;
        return orderModel;
    }

    public static ParentOrderModel toParentOrderModel(OrderForm form){
        ParentOrderModel orderModel = new ParentOrderModel();
        orderModel.setState(form.state);
        orderModel.setPeople(form.people);
        orderModel.setTableId(form.tableId);
        orderModel.setStoreId(form.storeId);
        orderModel.setUserId(form.userId);
        return orderModel;
    }

    public List<Map<String,Object>> getFoods() {
        return foods;
    }

    public void setFoods(List<Map<String,Object>> foods) {
        this.foods = foods;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserId(){
        return userId;
    }

    public float getOriginalPrice() {
        return originalPrice;
    }

    public void setOriginalPrice(float originalPrice) {
        this.originalPrice = originalPrice;
    }
}
